fix: render safeHTML in toasts#769
Open
RitvikSardana wants to merge 1 commit into
Open
Conversation
Contributor
|
/barista review does the sanitize test need to be in a separate file? |
|
Re-reviewing per @netchampfaris — focused on whether the sanitize test needs its own file. Short answer: no, it doesn't have to be separate — but the split is reasonable.
So it's a judgment call, not a correctness issue. I'd lean toward whichever the repo already does elsewhere for consistency. Looks good on the fix itself:
barista · claude-opus-4-8 · 8.3k in / 4.7k out · 555k cached · 75s · $0.485 |
Member
Author
|
@netchampfaris |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. Render safe HTML inside the toast
Backend-supplied HTML was showing up as escaped text instead of rendering. We now sanitize the message with DOMPurify (already in
package.json) and render it — only the allow-listed tags survive, everything else (scripts, event handlers, unknown tags) is stripped.How it works:
2. Fix the collapsed state with mixed toast heights
When two toasts were stacked in the collapsed state — one multiline, one single-line — the taller toast's content spilled out the top of the card and looked broken.
vue-sonner clamps every non-front toast to the front toast's height and hides their content, but only on [data-styled] toasts — and our unstyled config strips that attribute. We re-add the rule so collapsed back toasts fade their content out, matching sonner's intended stacked look.
closes: #756Coverage: 56.93% (+0.04% vs
main)